package com.imooc.oauth2.server.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.RedisSentinelConfiguration;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;

/**
 * \* @author: bear
 * \* Date: 2021-09-27-14:29
 * \* describe:
 */
// @Configuration
public class RedisTemplateConfiguration {

	// @Bean
	public RedisConnectionFactory lettuceConnectionFactory(){
		RedisSentinelConfiguration sentinelConfiguration = new RedisSentinelConfiguration()
				.master("mymaster")
				.sentinel("127.0.0.1",26379)
				.sentinel("127.0.0.1",26380)
				.sentinel("127.0.0.1",26381);
		sentinelConfiguration.setDatabase(1);
		sentinelConfiguration.setPassword("");
		return new LettuceConnectionFactory(sentinelConfiguration);
	}
}
